from tkinter import *
from tkinter import Menu
import tkinter as tk

from database.manager.manager_employ import EmployPage
from database.manager.manager_member import MemberPage
from database.manager.manager_commodity import CommodityPage
from database.manager.manager_buy import BuyPage
from database.manager.manager_supplier import SupplierPage

def ManagerPage():

    admin_manager_screen = Tk()
    admin_manager_screen.title('超市进销存管理系统(管理员)')
    # 屏幕的宽度和高度
    screen_width, screen_height = admin_manager_screen.maxsize()
    # 窗口的宽和高
    width = 410
    height = 100
    centre = '%dx%d+%d+%d' % (width, height, (screen_width - width) / 2,
                              (screen_height - height) / 2)
    admin_manager_screen.geometry(centre)
    welcome = tk.Label(admin_manager_screen,text='欢迎来到超市进销存管理系统！',font=('楷体',20))
    welcome.place(x=10,y=20)

    def member(): #会员信息
        MemberPage()

    def employ(): #员工信息
        EmployPage()

    def commodity(): #商品信息
        CommodityPage()

    def buy(): #采购信息
        BuyPage()

    def supplier():#供应商信息
        SupplierPage()

    def manager_screen_quit():
        admin_manager_screen.destroy()

    menu_manager = Menu(admin_manager_screen) #顶级菜单
    menu_manager_child = Menu(menu_manager)  # 顶级菜单下的子菜单
    # 子菜单绑定到顶级菜单
    menu_manager.add_cascade(label='管理', menu=menu_manager_child)
    menu_manager.add_command(label='退出',command=manager_screen_quit)
    #子菜单
    menu_manager_child.add_command(label='会员信息', command=member)
    menu_manager_child.add_command(label='员工信息',command=employ)
    menu_manager_child.add_command(label='商品信息',command=commodity)
    menu_manager_child.add_command(label='采购信息', command=buy)
    menu_manager_child.add_command(label='供应商信息', command=supplier)

    admin_manager_screen.config(menu=menu_manager)

    admin_manager_screen.mainloop()

if __name__=='__main__':
    ManagerPage()